const path = require("path")

module.exports = {
    chainWebpack: config => {
        config.resolve.alias
            .set("components",path.resolve(__dirname,"./src/components"))
            .set("layout",path.resolve(__dirname,"./src/components/layout"))
            .set("pages",path.resolve(__dirname,"./src/pages"))
            .set("assets",path.resolve(__dirname,"./src/assets"))
            .set("utils",path.resolve(__dirname,"./src/utils"))
            .set("store",path.resolve(__dirname,"./src/store"))
            .set("router",path.resolve(__dirname,"./src/router"))
            .set("home",path.resolve(__dirname,"./src/pages/views/home"))
    },
    devServer: {
 
        proxy: {
            '/home' : {
                target: 'https://m-element.kaola.com',
                changeOrigin: true,
                headers: {
                    referer: 'https://m-element.kaola.com',
                    host: 'm-element.kaola.com'
                },
                hostRewrite: 'm-element.kaola.com'
            },
            '/app' : {
                target: 'https://m-element.kaola.com',
                changeOrigin: true,
                headers: {
                    referer: 'https://m-element.kaola.com',
                    host: 'm-element.kaola.com'
                },
                hostRewrite: 'm-element.kaola.com'
            },
            '/product' : {
                target: 'https://m-goods.kaola.com',
                changeOrigin: true,
                headers: {
                    referer: 'https://m-goods.kaola.com',
                    host: 'm-goods.kaola.com'
                },
                hostRewrite: 'm-goods.kaola.com'
            },
        }
    }
}